const pieOption = config => {
  const { title, data } = config;
  let option = {
    title: {
      text: title,
      left: 'center',
      textStyle: {
        fontSize: '16',
        fontWeight: 'bold',
        color: '#000'
      }
    },
    tooltip: {
      trigger: 'item',
      formatter: "{b}: {c} (占比: {d}%)"
    },
    grid: {
      left: '3%',
      right: '3%',
      bottom: '3%',
      containLabel: true
    },
    legend: {
      x: 'center',
      y: 'bottom',
      textStyle: {
        fontSize: '14',
        fontWeight: 'bold',
        color: '#000'
      }
    },
    series: [{
      name: '',
      type: 'pie',
      radius: ['40%', '55%'],
      center: ['50%', '50%'],
      hoverAnimation: true,
      label: {
        show: true,
        position: 'outside',
        formatter: '{b}: {c} (占比: {d}%)',
        textStyle: {
          fontSize: '14',
          fontWeight: 'bold',
          color: 'inherit'
        }
      },
      labelLine: {
        smooth: true,
        lineStyle: { width: 2 }
      },
      data: data
    }]
  };
  return option;
}

export { pieOption }